package classicalSATeaching;

import javax.swing.*;
import java.io.File;

public class fileChooserJframe {
    static JFrame frame = new JFrame();// 创建一个窗口
    public static void start(){

        frame.setTitle("经典软件体系结构教学软件");// 设置窗口标题

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JTextArea ta=new JTextArea(20,30);

        JFileChooser chooser=new JFileChooser();


        int status =chooser.showOpenDialog(null);

        if(status!=JFileChooser.APPROVE_OPTION)

            ta.setText("No file chosen!");

        else

        {

            File file=chooser.getSelectedFile();

            fileInfo.fileChoosed=true;
            fileInfo.fileName=file.getPath();

            frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            frame.setVisible(true);

            frame.dispose();
            mainJFrame.back();
        }
    }

}
